#用户输入密码，脚本判断密码是否正确，输入正确则提示正确，连续输入错误密码3次，则报警

#!/bin/bash
init=123456
for i in {1..3}
do
read -p "请输入密码:" pass
   if [ $pass == $init ];then​
      echo "密码正确"
      ​break
   fi
done
echo "警告：密码错误"